﻿@model Weibo.Web.Models.MySiteModel
@{
     Layout = "~/Views/Shared/_Layout.cshtml";
 }
 @{
     ViewBag.Title = "设置个性化域名 XX微博-随时随地分享身边的新鲜事儿";
 }
 @section  cssInsert{	
    <link href="/Content/CSS/setup.css" rel="stylesheet" type="text/css" />
    }
 @section  jsInsert{
	<script src="/Scripts/Setup.js" type="text/javascript"></script>
	<script type="text/javascript">
	    var mySite = {};
	    mySite.Edit = function (txt, alink) {
	        if (alink.locked)
	            return false;
	        if ($.trim(txt.val()).length > 20 || $.trim(txt.val()).length < 4) {
	            this.showError("只能输入4至20位");
	            return false;
	        }
	        if (/^[0-9]*$/i.test($.trim(txt.val()))) {
	            this.showError("不能全部是数字");
	            return false;
	        }
	        if (!/^[0-9A-Za-z]*$/i.test($.trim(txt.val()))) {
	            this.showError("只能是数字和英文");
	            return false;
	        }
	       
	        App.confirm("保存后就不能修改了,是否现在提交", function () {
	            alink.locked = true;
	            $.ajax(
       {
           url: "/Ajax/EditCustomSite",
           datatype: "json",
           cache: false,
           data: { CustomSite: $.trim(txt.val()) },
           type: "post",
           success: function (o) {
               if (o.Code == "A00001") {
                   App.showLoginDial();
               }
               else if (o.Code == "A00003") {
                   App.alert(CodeList["A00003"]);
               }
               else if (o.Code == "A00024") {
                   mySite.showError(CodeList["A00024"]);
               }
               else {
                   App.fullTip(CodeList[o.Code], 2000, window.location.href, 3);
               }
               alink.locked = false;

           }, error: function (request) {
               App.alert(CodeList["A00003"]);
               alink.locked = false;
           }
       });
	        });
	    };
	    mySite.showError = function (txt) {
	        var error = $("#urlError");
	        error.show();
	        error.text(txt);
	    };
	    mySite.clipboard = function (txt) {
	        if (!txt)
	            return false;
	        if ($.browser.msie) {
	            window.clipboardData.clearData();
	            window.clipboardData.setData("Text", txt);
	            App.fullTip("链接复制成功！ 你可以利用快捷方式Ctrl+V键粘贴到UC、QQ或MSN等聊天工具中。", 2000, null, 3);
	        }
	        else {
	            App.fullTip("你的浏览器不支持脚本复制或你拒绝了浏览器安全确认，请尝试手动[Ctrl+C]复制。", 2000, null, 1);
	        }
	    };
	    mySite.favorite = function () {
	        if ($.browser.msie) {
	            window.external.addFavorite("@BaseConfigs.GetWebDomain/@Model.CurUser.CustomSite", "@{@Model.CurUser.NickName}的微博");
	        }
	        else {
	            if (window.sidebar) {
	                window.sidebar.addPanel("@{@Model.CurUser.NickName}的微博", "@BaseConfigs.GetWebDomain/@Model.CurUser.CustomSite", "");
	            }
	        }
	    };
	</script>
    }



			<div class="MIB_blogbody">
				<!--找朋友-->
				<div class="MIB_column">
					<div class="MIB_main_cont">
						<div class="MIB_setup">
							<!--页签-->
							<div class="PY_tag">
								<ul>
									<li>
										<div class="PY_tago">
											<span class="bold">个人资料</span></div>
									</li>
									<li>
										<div class="PY_tagn">
											<span><a href="http://account.weibo.com/setting/myface">修改头像</a></span></div>
									</li>
									<li>
										<div class="PY_tagn">
											<span><a href="http://account.weibo.com/setting/privacy">隐私设置</a></span></div>
									</li>
									<li>
										<div class="PY_tagn">
											<span><a href="http://account.weibo.com/setting/notice">个性设置</a></span></div>
									</li>
								</ul>
							</div>
							<!--/页签-->
							<div id="system_information" style="display: none">
							</div>
							<!--个人资料-->
							<div class="setup_main">
								<div class="infoTop  MIB_line1">
									<div class="infoTop_nav">
										<span><a href="/Setup/baseinfo">基本信息</a></span> <span class="navBorder gray9">|</span>
										<span><a href="/Setup/EditPwd">修改密码</a></span> <span class="navBorder gray9">|</span>
										<span><a href="/Setup/Education">教育信息</a></span> <span class="navBorder gray9">|</span>
										<span><a href="http://account.weibo.com/setting/workinfo">职业信息</a></span> <span class="navBorder gray9">
											|</span> <span><a href="http://account.weibo.com/setting/tag">个人标签</a></span>
										<span class="navBorder gray9">|</span> <span class="edutop_cur">个性域名</span>
									</div>
								</div>
								@{
			                     if(string.IsNullOrEmpty(Model.CurUser.CustomSite))
								 {
								<div class="setup_pop4">
									<p class="font_14">
										记得自己的微博地址是什么吗？设置个性域名，让朋友更容易记住！</p>
									<p class="font_12 gray6">
										<i>·</i>可以输入<span class="error_color">4</span>至<span class="error_color">20</span>位的英文或数字（必须包含英文字符）</p>
									<p class="font_12 error_color">
										<i>·</i>保存后就不能修改了</p>
								</div>
								<div class="cudTs11 setup_pop3">
									<div class="cudCon">
										<p class="gray6 font_14 setup_info4">
											设置个性域名：</p>
										<div class="logininput">
											<input type="text" autocomplete="off" class="PY_input lf" id="url" onkeyup="$('#url1').text(this.value);" value="">
											<a href="javascript:void(0)" class="newabtngrn" id="submit" onclick="mySite.Edit($(this).prev(),this)"><em>确定</em></a>
											<p style="display: none" class="errorTs" id="urlError">
												这个域名被别人抢到啦，换一个吧！</p>
										</div>
										<p class="font_14 yellow2">
											如：@BaseConfigs.GetWebDomain/你的个性域名</p>
										<p class="gray6">
											你的网页域名是：@BaseConfigs.GetWebDomain/<span id="url1"></span></p>
									</div>
									<b class="topL"></b><b class="topR"></b><b class="botL"></b><b class="botR"></b>
								</div>
			                     }
								 else
								 {
								<div class="cudTs10 setup_pop2">
									<div class="cudCon">
										<p class="gray6 font_14 setup_info3">
											<img src="/Content/Image/transparent.gif" class="PY_ib10">你已经设置个性域名</p>
										<div class="font_14">
											<i>·</i>网页版：@BaseConfigs.GetWebDomain/<span>@Model.CurUser.CustomSite</span></div>
										<div class="link">
											<table>
												<tbody>
													<tr>
														<td class="td_1">
															<img src="/Content/Image/transparent.gif" class="small_icon star1" title="加入收藏夹"><a onclick="mySite.favorite();"
																href="javascript:void(0);" id="clk_collect">加入收藏夹</a>
														</td>
														<td class="td_2">
															<img src="/Content/Image/transparent.gif" class="small_icon yqfriend_ico" title="邀请朋友关注我"><a onclick="if ($('#copybox').is(':visible')) { $('#copybox').hide();  } else { $('#copybox').show();}"
																href="javascript:void(0);" id="clk_invite">邀请朋友关注我<img src="/Content/Image/transparent.gif"
																	class="small_icon arrowdown" title="邀请朋友关注我" ></a>
														</td>
													</tr>
												</tbody>
											</table>
										</div>
										<div class="linkCon" style="display: none;" id="copybox">
											<div class="logininput">
												<input type="text" value="@BaseConfigs.GetWebDomain/@Model.CurUser.CustomSite" onmouseover="this.focus();this.select();"
													readonly="readonly" id="copytext" class="PY_input lf">
												<a onclick="mySite.clipboard($(this).prev().val());return false;" id="copylink" href="javascript:void(0);" class="newabtngrn"><em>复制链接</em></a>
											</div>
											<p class="linkts gray9">
												将以上链接发给亲朋好友，他们接受邀请后会成为你的粉丝。</p>
										</div>
									</div>
									<b class="topL"></b><b class="topR"></b><b class="botL"></b><b class="botR"></b>
								</div>
			                     }
			                    }
								<div class="setup_block">
								</div>
							</div>
							<!--/个人资料-->
						</div>
					</div>
				</div>
				<!--/找朋友-->
			</div>

